package Vista;

import Complementos.Conexion_BD;
import Complementos.Validar;
import java.awt.event.KeyEvent;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;

public class frmEditarPersona extends javax.swing.JFrame {

    Validar validar = new Validar();
    ArrayList<ArrayList> listado = new ArrayList<ArrayList>();

    /*
     * CONSTRUCTOR - INICIALIZACION DE VALORES
     */
    public frmEditarPersona() {
        initComponents(); // UBICA TODOS LOS COMPONENTES VISUALES EN EL FORMULARIO
        txtBusqueda.requestFocus();
        cargarDepartamentos();

        // FORZAR QUE ELIJA A LIMA COMO DISTRITO PREDETERMINADO
        comboDepto.setSelectedItem("LIMA");



    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        buttonGroup1 = new javax.swing.ButtonGroup();
        buttonGroup2 = new javax.swing.ButtonGroup();
        jPanel1 = new javax.swing.JPanel();
        jPanel2 = new javax.swing.JPanel();
        btnBuscar = new javax.swing.JButton();
        comboBuscar = new javax.swing.JComboBox();
        txtBusqueda = new javax.swing.JTextField();
        jScrollPane1 = new javax.swing.JScrollPane();
        tblOdontologo = new javax.swing.JTable();
        tbpaneMantenerOdontologos = new javax.swing.JTabbedPane();
        panelOdontologo = new javax.swing.JPanel();
        jLabel2 = new javax.swing.JLabel();
        txtApellidoPaterno = new javax.swing.JTextField();
        txtApellidoMaterno = new javax.swing.JTextField();
        jLabel16 = new javax.swing.JLabel();
        jLabel1 = new javax.swing.JLabel();
        txtNombres = new javax.swing.JTextField();
        txtDni = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        txtDireccion = new javax.swing.JTextField();
        jLabel5 = new javax.swing.JLabel();
        txtTel = new javax.swing.JTextField();
        txtCelular = new javax.swing.JTextField();
        jLabel6 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        txtEmail = new javax.swing.JTextField();
        txtNacionalidad = new javax.swing.JTextField();
        jLabel24 = new javax.swing.JLabel();
        jLabel13 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jLabel15 = new javax.swing.JLabel();
        jLabel21 = new javax.swing.JLabel();
        jLabel19 = new javax.swing.JLabel();
        comboDepto = new javax.swing.JComboBox();
        comboProvincia = new javax.swing.JComboBox();
        comboDistrito = new javax.swing.JComboBox();
        comboFecha = new datechooser.beans.DateChooserCombo();
        txtEdad = new javax.swing.JTextField();
        txtCMP = new javax.swing.JTextField();
        txtFacultad = new javax.swing.JTextField();
        txtEspecialidad = new javax.swing.JTextField();
        jPanel3 = new javax.swing.JPanel();
        rbtMasculino = new javax.swing.JRadioButton();
        rbtFemenino = new javax.swing.JRadioButton();
        jLabel9 = new javax.swing.JLabel();
        btnActualizar = new javax.swing.JButton();
        btnEliminar = new javax.swing.JButton();
        jButton1 = new javax.swing.JButton();
        btnModificar = new javax.swing.JButton();
        jTextField1 = new javax.swing.JTextField();
        jLabel14 = new javax.swing.JLabel();
        jTabbedPane2 = new javax.swing.JTabbedPane();
        jPanel4 = new javax.swing.JPanel();
        rbtMasculino1 = new javax.swing.JRadioButton();
        rbtFemenino1 = new javax.swing.JRadioButton();
        rbtTodos = new javax.swing.JRadioButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

        jPanel1.setBackground(new java.awt.Color(204, 204, 240));

        jPanel2.setBackground(new java.awt.Color(204, 204, 240));
        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Mantenimiento", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tunga", 0, 18), new java.awt.Color(255, 255, 153))); // NOI18N

        btnBuscar.setText("Buscar");
        btnBuscar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnBuscarActionPerformed(evt);
            }
        });

        comboBuscar.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Buscar por Nombre", "Buscar por Apellido paterno", "Buscar por Apellido materno" }));
        comboBuscar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                comboBuscarActionPerformed(evt);
            }
        });

        tblOdontologo.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null, null, null}
            },
            new String [] {
                "CMP", "Especialidad", "Nombres", "Apellidos", "DNI", "Distrito", "Domicilio", "Email", "Telefono", "Celular", "Genero"
            }
        ) {
            boolean[] canEdit = new boolean [] {
                false, false, false, false, false, false, false, false, false, false, false
            };

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        tblOdontologo.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        tblOdontologo.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tblOdontologoMouseClicked(evt);
            }
        });
        jScrollPane1.setViewportView(tblOdontologo);

        tbpaneMantenerOdontologos.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));

        panelOdontologo.setBackground(new java.awt.Color(204, 204, 255));
        panelOdontologo.setEnabled(false);

        jLabel2.setText("Apellido Paterno:");

        txtApellidoPaterno.setEditable(false);
        txtApellidoPaterno.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                txtApellidoPaternoKeyPressed(evt);
            }
        });

        txtApellidoMaterno.setEditable(false);
        txtApellidoMaterno.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                txtApellidoMaternoKeyPressed(evt);
            }
        });

        jLabel16.setText("Apellido Materno:");

        jLabel1.setText("Nombres:");

        txtNombres.setEditable(false);
        txtNombres.setAutoscrolls(false);
        txtNombres.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtNombresActionPerformed(evt);
            }
        });
        txtNombres.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                txtNombresKeyPressed(evt);
            }
        });

        txtDni.setEditable(false);
        txtDni.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                txtDniKeyPressed(evt);
            }
        });

        jLabel3.setText("DNI:");

        jLabel4.setText("Dirección:");

        txtDireccion.setEditable(false);
        txtDireccion.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                txtDireccionKeyPressed(evt);
            }
        });

        jLabel5.setText("Teléfono:");

        txtTel.setEditable(false);
        txtTel.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                txtTelKeyPressed(evt);
            }
        });

        txtCelular.setEditable(false);
        txtCelular.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                txtCelularKeyPressed(evt);
            }
        });

        jLabel6.setText("Celular:");

        jLabel11.setText("Email:");

        txtEmail.setEditable(false);
        txtEmail.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                txtEmailKeyPressed(evt);
            }
        });

        txtNacionalidad.setEditable(false);
        txtNacionalidad.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                txtNacionalidadKeyPressed(evt);
            }
        });

        jLabel24.setText("Nacionalidad:");

        jLabel13.setText("Facultad:");

        jLabel12.setText("Especialidad:");

        jLabel10.setText("CMP:");

        jLabel8.setText("Edad:");

        jLabel7.setText("Fecha Nac:");

        jLabel15.setText("Distrito:");

        jLabel21.setText("Provincia:");

        jLabel19.setText("Departamento:");

        comboDepto.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                comboDeptoItemStateChanged(evt);
            }
        });

        comboProvincia.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                comboProvinciaItemStateChanged(evt);
            }
        });

        comboFecha.setCurrentView(new datechooser.view.appearance.AppearancesList("Grey",
            new datechooser.view.appearance.ViewAppearance("custom",
                new datechooser.view.appearance.swing.SwingCellAppearance(new java.awt.Font("Tahoma", java.awt.Font.PLAIN, 11),
                    new java.awt.Color(0, 0, 0),
                    new java.awt.Color(0, 0, 255),
                    false,
                    true,
                    new datechooser.view.appearance.swing.ButtonPainter()),
                new datechooser.view.appearance.swing.SwingCellAppearance(new java.awt.Font("Tahoma", java.awt.Font.PLAIN, 11),
                    new java.awt.Color(0, 0, 0),
                    new java.awt.Color(0, 0, 255),
                    true,
                    true,
                    new datechooser.view.appearance.swing.ButtonPainter()),
                new datechooser.view.appearance.swing.SwingCellAppearance(new java.awt.Font("Tahoma", java.awt.Font.PLAIN, 11),
                    new java.awt.Color(0, 0, 255),
                    new java.awt.Color(0, 0, 255),
                    false,
                    true,
                    new datechooser.view.appearance.swing.ButtonPainter()),
                new datechooser.view.appearance.swing.SwingCellAppearance(new java.awt.Font("Tahoma", java.awt.Font.PLAIN, 11),
                    new java.awt.Color(128, 128, 128),
                    new java.awt.Color(0, 0, 255),
                    false,
                    true,
                    new datechooser.view.appearance.swing.LabelPainter()),
                new datechooser.view.appearance.swing.SwingCellAppearance(new java.awt.Font("Tahoma", java.awt.Font.PLAIN, 11),
                    new java.awt.Color(0, 0, 0),
                    new java.awt.Color(0, 0, 255),
                    false,
                    true,
                    new datechooser.view.appearance.swing.LabelPainter()),
                new datechooser.view.appearance.swing.SwingCellAppearance(new java.awt.Font("Tahoma", java.awt.Font.PLAIN, 11),
                    new java.awt.Color(0, 0, 0),
                    new java.awt.Color(255, 0, 0),
                    false,
                    false,
                    new datechooser.view.appearance.swing.ButtonPainter()),
                (datechooser.view.BackRenderer)null,
                false,
                true)));
    comboFecha.setEnabled(false);
    comboFecha.setLocale(new java.util.Locale("es", "PE", ""));
    comboFecha.addSelectionChangedListener(new datechooser.events.SelectionChangedListener() {
        public void onSelectionChange(datechooser.events.SelectionChangedEvent evt) {
            comboFechaOnSelectionChange(evt);
        }
    });

    txtEdad.setEditable(false);
    txtEdad.addKeyListener(new java.awt.event.KeyAdapter() {
        public void keyPressed(java.awt.event.KeyEvent evt) {
            txtEdadKeyPressed(evt);
        }
    });

    txtCMP.setEditable(false);
    txtCMP.addKeyListener(new java.awt.event.KeyAdapter() {
        public void keyPressed(java.awt.event.KeyEvent evt) {
            txtCMPKeyPressed(evt);
        }
    });

    txtFacultad.setEditable(false);

    txtEspecialidad.setEditable(false);
    txtEspecialidad.addKeyListener(new java.awt.event.KeyAdapter() {
        public void keyPressed(java.awt.event.KeyEvent evt) {
            txtEspecialidadKeyPressed(evt);
        }
    });

    jPanel3.setBackground(new java.awt.Color(204, 204, 240));
    jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 255, 204)), "Género"));

    rbtMasculino.setBackground(new java.awt.Color(204, 204, 255));
    buttonGroup1.add(rbtMasculino);
    rbtMasculino.setText("Masculino");
    rbtMasculino.setActionCommand("M");

    rbtFemenino.setBackground(new java.awt.Color(204, 204, 255));
    buttonGroup1.add(rbtFemenino);
    rbtFemenino.setText("Femenino");
    rbtFemenino.setActionCommand("F");

    javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
    jPanel3.setLayout(jPanel3Layout);
    jPanel3Layout.setHorizontalGroup(
        jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addGroup(jPanel3Layout.createSequentialGroup()
            .addContainerGap()
            .addComponent(rbtMasculino)
            .addGap(18, 18, 18)
            .addComponent(rbtFemenino)
            .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
    );
    jPanel3Layout.setVerticalGroup(
        jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addGroup(jPanel3Layout.createSequentialGroup()
            .addContainerGap()
            .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                .addComponent(rbtMasculino)
                .addComponent(rbtFemenino))
            .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
    );

    jLabel9.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Media/agregarOdontologo2.png"))); // NOI18N

    btnActualizar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Media/update.png"))); // NOI18N
    btnActualizar.setText("Actualizar");
    btnActualizar.setEnabled(false);
    btnActualizar.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            btnActualizarActionPerformed(evt);
        }
    });

    btnEliminar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Media/btnEliminar.png"))); // NOI18N
    btnEliminar.setText("Eliminar");
    btnEliminar.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            btnEliminarActionPerformed(evt);
        }
    });

    jButton1.setText("Registro Nuevo");
    jButton1.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButton1ActionPerformed(evt);
        }
    });

    btnModificar.setText("Modificar");
    btnModificar.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            btnModificarActionPerformed(evt);
        }
    });

    jTextField1.setEditable(false);

    jLabel14.setText("Codigo:");

    javax.swing.GroupLayout panelOdontologoLayout = new javax.swing.GroupLayout(panelOdontologo);
    panelOdontologo.setLayout(panelOdontologoLayout);
    panelOdontologoLayout.setHorizontalGroup(
        panelOdontologoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addGroup(panelOdontologoLayout.createSequentialGroup()
            .addGap(45, 45, 45)
            .addGroup(panelOdontologoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(panelOdontologoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel16)
                    .addComponent(jLabel1)
                    .addComponent(jLabel3)
                    .addComponent(jLabel4)
                    .addComponent(jLabel5)
                    .addComponent(jLabel6)
                    .addComponent(jLabel11)
                    .addComponent(jLabel2))
                .addComponent(jLabel14))
            .addGap(18, 18, 18)
            .addGroup(panelOdontologoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(panelOdontologoLayout.createSequentialGroup()
                    .addGroup(panelOdontologoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(txtEmail, javax.swing.GroupLayout.PREFERRED_SIZE, 124, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(txtApellidoPaterno, javax.swing.GroupLayout.PREFERRED_SIZE, 124, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(txtCelular, javax.swing.GroupLayout.PREFERRED_SIZE, 124, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(txtDni, javax.swing.GroupLayout.PREFERRED_SIZE, 124, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(txtTel, javax.swing.GroupLayout.PREFERRED_SIZE, 124, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(txtDireccion, javax.swing.GroupLayout.PREFERRED_SIZE, 124, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(txtNombres, javax.swing.GroupLayout.PREFERRED_SIZE, 124, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(txtApellidoMaterno, javax.swing.GroupLayout.PREFERRED_SIZE, 124, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGap(51, 51, 51)
                    .addGroup(panelOdontologoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addComponent(jLabel12)
                        .addComponent(jLabel13)
                        .addComponent(jLabel10)
                        .addComponent(jLabel8)
                        .addComponent(jLabel7)
                        .addComponent(jLabel15)
                        .addComponent(jLabel21)
                        .addComponent(jLabel19))
                    .addGap(18, 18, 18)
                    .addGroup(panelOdontologoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(comboProvincia, javax.swing.GroupLayout.PREFERRED_SIZE, 155, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(comboDistrito, javax.swing.GroupLayout.PREFERRED_SIZE, 155, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(comboFecha, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(txtEdad, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(txtCMP, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(txtEspecialidad, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(txtFacultad, javax.swing.GroupLayout.PREFERRED_SIZE, 182, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(comboDepto, javax.swing.GroupLayout.PREFERRED_SIZE, 155, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGroup(panelOdontologoLayout.createSequentialGroup()
                    .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(107, 107, 107)
                    .addComponent(jLabel24)
                    .addGap(27, 27, 27)
                    .addComponent(txtNacionalidad, javax.swing.GroupLayout.PREFERRED_SIZE, 155, javax.swing.GroupLayout.PREFERRED_SIZE)))
            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 41, Short.MAX_VALUE)
            .addGroup(panelOdontologoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelOdontologoLayout.createSequentialGroup()
                    .addGroup(panelOdontologoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(btnActualizar, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 133, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(btnModificar, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 133, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGap(18, 18, 18)
                    .addGroup(panelOdontologoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(btnEliminar, javax.swing.GroupLayout.PREFERRED_SIZE, 133, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 133, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGap(59, 59, 59))
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelOdontologoLayout.createSequentialGroup()
                    .addComponent(jLabel9)
                    .addGap(136, 136, 136))
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelOdontologoLayout.createSequentialGroup()
                    .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(104, 104, 104))))
    );

    panelOdontologoLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {btnActualizar, btnEliminar, btnModificar, jButton1});

    panelOdontologoLayout.setVerticalGroup(
        panelOdontologoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addGroup(panelOdontologoLayout.createSequentialGroup()
            .addGap(18, 18, 18)
            .addGroup(panelOdontologoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                .addGroup(panelOdontologoLayout.createSequentialGroup()
                    .addGroup(panelOdontologoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel14)
                        .addComponent(txtNacionalidad, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel24))
                    .addGap(20, 20, 20)
                    .addGroup(panelOdontologoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(comboDepto, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(txtApellidoPaterno, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel2)
                        .addComponent(jLabel19)))
                .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
            .addGroup(panelOdontologoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(panelOdontologoLayout.createSequentialGroup()
                    .addGap(18, 18, 18)
                    .addGroup(panelOdontologoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(txtApellidoMaterno, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel16)
                        .addComponent(jLabel21)
                        .addComponent(comboProvincia, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGap(18, 18, 18)
                    .addGroup(panelOdontologoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(txtNombres, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel1)
                        .addComponent(comboDistrito, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel15))
                    .addGap(22, 22, 22)
                    .addGroup(panelOdontologoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(panelOdontologoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(txtDni, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel3)
                            .addComponent(jLabel7))
                        .addComponent(comboFecha, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGap(23, 23, 23)
                    .addGroup(panelOdontologoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(txtDireccion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel4)
                        .addComponent(txtEdad, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel8))
                    .addGap(18, 18, 18)
                    .addGroup(panelOdontologoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(txtTel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel5)
                        .addComponent(txtCMP, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel10))
                    .addGap(20, 20, 20)
                    .addGroup(panelOdontologoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(txtCelular, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel6)
                        .addComponent(txtEspecialidad, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel12))
                    .addGap(18, 18, 18)
                    .addGroup(panelOdontologoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(txtEmail, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel11)
                        .addComponent(jLabel13)
                        .addComponent(txtFacultad, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGroup(panelOdontologoLayout.createSequentialGroup()
                    .addGap(39, 39, 39)
                    .addComponent(jLabel9)
                    .addGap(18, 18, 18)
                    .addGroup(panelOdontologoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(btnModificar))
                    .addGap(18, 18, 18)
                    .addGroup(panelOdontologoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(btnEliminar)
                        .addComponent(btnActualizar, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE))))
            .addGap(0, 37, Short.MAX_VALUE))
    );

    panelOdontologoLayout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {btnActualizar, btnEliminar, btnModificar, jButton1});

    tbpaneMantenerOdontologos.addTab("Datos odontólogo", panelOdontologo);
    tbpaneMantenerOdontologos.addTab("Ver consultas", jTabbedPane2);

    jPanel4.setBackground(new java.awt.Color(204, 204, 240));
    jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 255, 204)), "Género"));

    rbtMasculino1.setBackground(new java.awt.Color(204, 204, 255));
    buttonGroup2.add(rbtMasculino1);
    rbtMasculino1.setText("Masculino");
    rbtMasculino1.setActionCommand("M");

    rbtFemenino1.setBackground(new java.awt.Color(204, 204, 255));
    buttonGroup2.add(rbtFemenino1);
    rbtFemenino1.setText("Femenino");
    rbtFemenino1.setActionCommand("F");

    rbtTodos.setBackground(new java.awt.Color(204, 204, 255));
    buttonGroup2.add(rbtTodos);
    rbtTodos.setSelected(true);
    rbtTodos.setText("Todos");

    javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
    jPanel4.setLayout(jPanel4Layout);
    jPanel4Layout.setHorizontalGroup(
        jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addGroup(jPanel4Layout.createSequentialGroup()
            .addContainerGap()
            .addComponent(rbtTodos)
            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
            .addComponent(rbtMasculino1)
            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
            .addComponent(rbtFemenino1)
            .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
    );
    jPanel4Layout.setVerticalGroup(
        jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addGroup(jPanel4Layout.createSequentialGroup()
            .addContainerGap()
            .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                .addComponent(rbtTodos)
                .addComponent(rbtMasculino1)
                .addComponent(rbtFemenino1))
            .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
    );

    javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
    jPanel2.setLayout(jPanel2Layout);
    jPanel2Layout.setHorizontalGroup(
        jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addGroup(jPanel2Layout.createSequentialGroup()
            .addGap(26, 26, 26)
            .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 1017, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGroup(jPanel2Layout.createSequentialGroup()
                    .addGap(13, 13, 13)
                    .addComponent(comboBuscar, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(18, 18, 18)
                    .addComponent(txtBusqueda, javax.swing.GroupLayout.PREFERRED_SIZE, 178, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(18, 18, 18)
                    .addComponent(btnBuscar, javax.swing.GroupLayout.PREFERRED_SIZE, 107, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(57, 57, 57)
                    .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
            .addContainerGap(28, Short.MAX_VALUE))
        .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
            .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(tbpaneMantenerOdontologos, javax.swing.GroupLayout.PREFERRED_SIZE, 984, javax.swing.GroupLayout.PREFERRED_SIZE)
            .addGap(42, 42, 42))
    );
    jPanel2Layout.setVerticalGroup(
        jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addGroup(jPanel2Layout.createSequentialGroup()
            .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel2Layout.createSequentialGroup()
                    .addGap(15, 15, 15)
                    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(comboBuscar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(txtBusqueda, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(btnBuscar)))
                .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
            .addGap(18, 18, 18)
            .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 86, javax.swing.GroupLayout.PREFERRED_SIZE)
            .addGap(18, 18, 18)
            .addComponent(tbpaneMantenerOdontologos, javax.swing.GroupLayout.PREFERRED_SIZE, 420, javax.swing.GroupLayout.PREFERRED_SIZE)
            .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
    );

    javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
    jPanel1.setLayout(jPanel1Layout);
    jPanel1Layout.setHorizontalGroup(
        jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
            .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
            .addContainerGap())
    );
    jPanel1Layout.setVerticalGroup(
        jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, 651, Short.MAX_VALUE)
    );

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(
        layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
    );
    layout.setVerticalGroup(
        layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
    );

    pack();
    }// </editor-fold>//GEN-END:initComponents

    private void txtNombresKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtNombresKeyPressed

        if ((evt.getKeyCode() == KeyEvent.VK_ENTER)) {
            if (validar.esVacio(txtNombres.getText())) {
                JOptionPane.showMessageDialog(this, "Debe ingresar un nombre", "Campo obligatorio", JOptionPane.ERROR_MESSAGE);
                txtNombres.requestFocus();
//                System.out.print(validar.validarTexto(txtNombres.getText()));
            } else if (validar.validarTexto(txtNombres.getText())) {


                txtApellidoPaterno.requestFocus();
            } else {
                JOptionPane.showMessageDialog(this, "El nombre no debe contener numeros/símbolos", "Error", JOptionPane.ERROR_MESSAGE);
                txtNombres.requestFocus();
                txtNombres.selectAll();
            }
        }
    }//GEN-LAST:event_txtNombresKeyPressed

    private void txtApellidoPaternoKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtApellidoPaternoKeyPressed
        if (evt.getKeyCode() == evt.VK_ENTER) {
            if (validar.esVacio(txtApellidoPaterno.getText())) {
                JOptionPane.showMessageDialog(this, "Debe ingresar apellidos", "Campo obligatorio", JOptionPane.ERROR_MESSAGE);
                txtApellidoPaterno.requestFocus();
            } else if (validar.validarTexto(txtApellidoPaterno.getText())) {
                txtDni.requestFocus();
            } else {
                JOptionPane.showMessageDialog(this, "El apellido no debe contener numeros/símbolos", "Error", JOptionPane.ERROR_MESSAGE);
                txtApellidoPaterno.requestFocus();
                txtApellidoPaterno.selectAll();
            }
        }
    }//GEN-LAST:event_txtApellidoPaternoKeyPressed

    private void txtDniKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtDniKeyPressed
        if (evt.getKeyCode() == evt.VK_ENTER) {
            if (validar.validarDni(txtDni.getText()) && validar.validarLongitud(8, txtDni.getText())) {
                txtDireccion.requestFocus();
            } else {
                JOptionPane.showMessageDialog(this, "DNI incorrecto, sólo debe contener numeros y debe ser de 8 dígitos", "Error", JOptionPane.ERROR_MESSAGE);
                txtDni.requestFocus();
                txtDni.selectAll();
            }
        }
    }//GEN-LAST:event_txtDniKeyPressed

    private void txtDireccionKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtDireccionKeyPressed
        if (evt.getKeyCode() == evt.VK_ENTER) {
            if (validar.esVacio(txtDireccion.getText())) {
                JOptionPane.showMessageDialog(this, "Debe ingresar direccion", "Campo obligatorio", JOptionPane.ERROR_MESSAGE);
                txtDireccion.requestFocus();
            }
            txtTel.requestFocus();
        }
   }//GEN-LAST:event_txtDireccionKeyPressed

    private void txtTelKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtTelKeyPressed
        if (evt.getKeyCode() == evt.VK_ENTER) {
            if (validar.esVacio(txtTel.getText())) {
                JOptionPane.showMessageDialog(this, "Debe ingresar telefono", "Campo obligatorio", JOptionPane.ERROR_MESSAGE);
                txtTel.requestFocus();
            } else if (validar.validarNro(txtTel.getText())) {
                txtCelular.requestFocus();
            } else {
                JOptionPane.showMessageDialog(this, "El teléfono sólo debe contener numeros", "Error", JOptionPane.ERROR_MESSAGE);
                txtTel.requestFocus();
                txtTel.selectAll();
            }
        }
    }//GEN-LAST:event_txtTelKeyPressed

    private void comboDeptoItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_comboDeptoItemStateChanged
        comboProvincia.removeAllItems();
        int cod = comboDepto.getSelectedIndex() + 1;
        cargarProvincias(cod);
    }//GEN-LAST:event_comboDeptoItemStateChanged

    private void comboProvinciaItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_comboProvinciaItemStateChanged
        comboDistrito.removeAllItems();
        int codD = comboDepto.getSelectedIndex() + 1;
        int codP = comboProvincia.getSelectedIndex() + 1;
        cargarDistritos(codD, codP);
    }//GEN-LAST:event_comboProvinciaItemStateChanged

    private void txtEdadKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtEdadKeyPressed
   }//GEN-LAST:event_txtEdadKeyPressed

    private void txtCelularKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtCelularKeyPressed
        if (evt.getKeyCode() == evt.VK_ENTER) {
            if (validar.validarNro(txtCelular.getText()) && validar.validarLongitud(9, txtCelular.getText())) {
                txtEmail.requestFocus();
            } else {
                JOptionPane.showMessageDialog(this, "El celular sólo debe contener numeros y no debe superar los 9 dígitos", "Error", JOptionPane.ERROR_MESSAGE);
                txtCelular.requestFocus();
                txtCelular.selectAll();
            }
        }
    }//GEN-LAST:event_txtCelularKeyPressed

    private void txtEmailKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtEmailKeyPressed
        if (evt.getKeyCode() == evt.VK_ENTER) {
            if (txtEmail.getText().equals("")) {
                txtNacionalidad.requestFocus();
            } else if (validar.validarEmail(txtEmail.getText())) {
                txtNacionalidad.requestFocus();
            } else {
                JOptionPane.showMessageDialog(this, "Email incorrecto", "Error", JOptionPane.ERROR_MESSAGE);
                txtEmail.requestFocus();
                txtEmail.selectAll();
            }
        }
    }//GEN-LAST:event_txtEmailKeyPressed

    private void txtNacionalidadKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtNacionalidadKeyPressed
        if (evt.getKeyCode() == evt.VK_ENTER) {
            if (validar.validarTexto(txtNacionalidad.getText())) {
                comboDepto.requestFocus();
            } else {
                JOptionPane.showMessageDialog(this, "La nacionalidad no debe contener numeros/símbolos", "Error", JOptionPane.ERROR_MESSAGE);
                txtNacionalidad.requestFocus();
                txtNacionalidad.selectAll();
            }
        }
    }//GEN-LAST:event_txtNacionalidadKeyPressed

    private void txtCMPKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtCMPKeyPressed
        if (evt.getKeyCode() == evt.VK_ENTER) {
            if (validar.validarNro(txtCMP.getText())) {
                txtEspecialidad.requestFocus();
            } else {
                JOptionPane.showMessageDialog(this, "El CMP sólo debe contener numeros", "Error", JOptionPane.ERROR_MESSAGE);
                txtCMP.requestFocus();
                txtCMP.selectAll();
            }
        }
    }//GEN-LAST:event_txtCMPKeyPressed

    private void txtEspecialidadKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtEspecialidadKeyPressed
        if (evt.getKeyCode() == evt.VK_ENTER) {
            txtFacultad.requestFocus();
        }
    }//GEN-LAST:event_txtEspecialidadKeyPressed

    private void btnActualizarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnActualizarActionPerformed
        try {
                  
            Conexion_BD conexion = new Conexion_BD();
            conexion.Conectar();

           // String busca = txtBusqueda.getText();

            //int idUbigeo = 12;
            String apellidoPaterno = txtApellidoPaterno.getText();
            String apellidoMaterno = txtApellidoMaterno.getText();
            String nombres = txtNombres.getText();
            String dni = txtDni.getText();
            String direccion = txtDireccion.getText();
            String telefono = txtTel.getText();
            String celular = txtCelular.getText();
            String email = txtEmail.getText();
            String nacionalidad = txtNacionalidad.getText();
            String fechanac = "1990/12/21";
            char genero;
            int activo = 1;

            if (rbtMasculino.isSelected()) {
                genero = rbtMasculino.getActionCommand().charAt(0);
            } else {
                genero = rbtFemenino.getActionCommand().charAt(0);
            }

            String query = "UPDATE PERSONA set nombres = '" + nombres + "' , " + " apellidoPaterno = '" + apellidoPaterno + "' , "+ " apellidoMaterno = '" + apellidoMaterno + "' , "+ " dni = '" + dni + "' , "+" nacionalidad = '" + nacionalidad + "' , " + " domicilio = '" + direccion + "' , "+" email = '" + email + "' , "+ " telefono = '" + telefono + "' , " + " celular = '" + celular + "' , " + " fechanac = '" + fechanac + "' , " + " genero = '" + genero + "' where idPersona = '" + jTextField1.getText() +"'";
            conexion.insupdel(query);

            
            JOptionPane.showMessageDialog(this, "SE ACTUALIZO CORRECTAMENTE");

            txtBusqueda.requestFocus();

            try {
                conexion.Desconectar();
            } catch (Exception ex) {
                Logger.getLogger(frmEditarPersona.class.getName()).log(Level.SEVERE, null, ex);
            }
        } catch (ClassNotFoundException ex) {
            Logger.getLogger(frmEditarPersona.class.getName()).log(Level.SEVERE, null, ex);
        } catch (SQLException ex) {
            Logger.getLogger(frmEditarPersona.class.getName()).log(Level.SEVERE, null, ex);
        }

    }//GEN-LAST:event_btnActualizarActionPerformed

    private void comboFechaOnSelectionChange(datechooser.events.SelectionChangedEvent evt) {//GEN-FIRST:event_comboFechaOnSelectionChange
        //txtEdad.setText("" + validar.calcularEdad(comboFecha.getText()));
    }//GEN-LAST:event_comboFechaOnSelectionChange

    private void btnBuscarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBuscarActionPerformed

        limpiarTablaOdontologo();
        char genero = '%';
        if (rbtMasculino1.isSelected()) {
            genero = 'M';
        }

        if (rbtFemenino1.isSelected()) {
            genero = 'F';
        }

        int opcionSeleccionada = comboBuscar.getSelectedIndex();

        cargarTablaOdontologo(opcionSeleccionada, genero);
        
        habilitarCampos(false);
        
        btnModificar.setEnabled(true);
        btnActualizar.setEnabled(false);
    }//GEN-LAST:event_btnBuscarActionPerformed

    private void txtNombresActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtNombresActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtNombresActionPerformed

    private void btnEliminarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnEliminarActionPerformed
        try {
            Conexion_BD conexion = new Conexion_BD();

            conexion.Conectar();

            int opcion = comboBuscar.getSelectedIndex();

            if (opcion == 0) {
                int codigo = Integer.parseInt(txtBusqueda.getText());
                conexion.insupdel("UPDATE persona SET activoPersona=0 WHERE idPersona=" + codigo);
            } else {
                String nombre = txtBusqueda.getText();
                conexion.insupdel("UPDATE persona SET activoPersona=0 WHERE nombres='" + nombre + "'");
            }


            JOptionPane.showMessageDialog(this, "SE ELIMINO EL REGISTRO");

            txtNombres.setText("");
            txtApellidoPaterno.setText("");
            txtApellidoMaterno.setText("");
            txtDni.setText("");
            txtDireccion.setText("");
            txtTel.setText("");
            txtCelular.setText("");
            txtEmail.setText("");
            txtNacionalidad.setText("");

            // rbtFemenino.setSelected(False);

            txtBusqueda.setText("");

            txtBusqueda.requestFocus();

            try {
                conexion.Desconectar();
            } catch (Exception ex) {
                Logger.getLogger(frmEditarPersona.class.getName()).log(Level.SEVERE, null, ex);
            }
        } catch (ClassNotFoundException ex) {
            Logger.getLogger(frmEditarPersona.class.getName()).log(Level.SEVERE, null, ex);
        } catch (SQLException ex) {
            Logger.getLogger(frmEditarPersona.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_btnEliminarActionPerformed

    private void comboBuscarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comboBuscarActionPerformed
    }//GEN-LAST:event_comboBuscarActionPerformed

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        frmRegistrarOdontologo fr = new frmRegistrarOdontologo();

        fr.setVisible(true);

    }//GEN-LAST:event_jButton1ActionPerformed

    private void txtApellidoMaternoKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtApellidoMaternoKeyPressed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtApellidoMaternoKeyPressed

    private void tblOdontologoMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tblOdontologoMouseClicked
        ArrayList<String> lista = new ArrayList<String>();
        int n = -1;
        String CMP;
        n = tblOdontologo.getSelectedRow();

        CMP = "" + tblOdontologo.getValueAt(n, 0).toString();
//        System.out.println(CMP);
        lista = traerOdontologoPorCMP(CMP);


        //tbpaneMantenerOdontologos.setSelectedIndex(0);

        //Pasamos los datos a las cajas de texto

        txtApellidoPaterno.setText(lista.get(0));
        txtApellidoMaterno.setText(lista.get(1));
        txtNombres.setText(lista.get(2));
        txtDni.setText(lista.get(3));
        txtDireccion.setText(lista.get(4));
        txtTel.setText(lista.get(5));
        txtCelular.setText(lista.get(6));
        txtEmail.setText(lista.get(7));
        txtNacionalidad.setText(lista.get(8));
        comboDepto.setSelectedIndex(Integer.parseInt(lista.get(9))-1); 
        comboProvincia.setSelectedIndex(Integer.parseInt(lista.get(10))-1); 
        comboDistrito.setSelectedIndex(Integer.parseInt(lista.get(11))-1); 
       
        comboFecha.setText( ""+validar.cambiarFormatoFecha(lista.get(12)));
        
//        System.out.println("PROBANDO:"+validar.cambiarFormatoFecha(  lista.get(12))); 
        txtEdad.setText(""+validar.calcularEdad(validar.cambiarFormatoFecha(lista.get(12)))); 
        txtCMP.setText(lista.get(13));        
        txtEspecialidad.setText(lista.get(14));
        txtFacultad.setText(lista.get(15));   
        if (lista.get(16).equals("M")) {
            rbtMasculino.setSelected(true);
        } else {
            rbtFemenino.setSelected(true);
        }
        jTextField1.setText(lista.get(17));



    }//GEN-LAST:event_tblOdontologoMouseClicked

    private void btnModificarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnModificarActionPerformed
        habilitarCampos(true);
        btnActualizar.setEnabled(true);
        btnModificar.setEnabled(false);
    }//GEN-LAST:event_btnModificarActionPerformed

    public void habilitarCampos(boolean xvalor){
        txtApellidoPaterno.setEditable(xvalor);
        txtApellidoMaterno.setEditable(xvalor);
        txtNombres.setEditable(xvalor);
        txtDni.setEditable(xvalor);
        txtDireccion.setEditable(xvalor);
        txtTel.setEditable(xvalor);
        txtCelular.setEditable(xvalor);
        txtEmail.setEditable(xvalor);
        txtNacionalidad.setEditable(xvalor);
        txtApellidoPaterno.requestFocus();
    
    }
    
    
    public ArrayList<String> traerOdontologoPorCMP(String CMP) {
        ArrayList<String> xlista = new ArrayList<String>();
        try {
            Conexion_BD conexion = new Conexion_BD();
            ResultSet rs = null;
            conexion.Conectar();

            String query = "SELECT p.apellidoPaterno,p.apellidoMaterno,p.nombres,p.dni,p.domicilio,p.telefono,p.celular,p.email,"
                    + "p.nacionalidad,u.coddepto,u.codprov,u.coddist,p.fechanac,o.CMP,o.especialidad,o.facultad,p.genero,p.idPERSONA "
                    + "FROM  odontologo o,persona p , ubigeo u WHERE o.idPERSONA = p.idPERSONA AND p.idUbigeo = u.idUbigeo AND o.cmp='" + CMP + "'";
            rs = conexion.Consultar(query);
//             System.out.println(query);   
            while (rs.next()) {
                xlista.add(rs.getString(1));
                xlista.add(rs.getString(2));
                xlista.add(rs.getString(3));
                xlista.add(rs.getString(4));
                xlista.add(rs.getString(5));
                xlista.add(rs.getString(6));
                xlista.add(rs.getString(7));
                xlista.add(rs.getString(8));
                xlista.add(rs.getString(9));
                xlista.add(rs.getString(10));
                xlista.add(rs.getString(11));
                xlista.add(rs.getString(12));
                xlista.add(rs.getString(13));
                xlista.add(rs.getString(14));
                xlista.add(rs.getString(15));
                xlista.add(rs.getString(16));
                xlista.add(rs.getString(17));
                xlista.add(rs.getString(18));
            }


        } catch (ClassNotFoundException ex) {
            Logger.getLogger(frmEditarPersona.class.getName()).log(Level.SEVERE, null, ex);
        } catch (SQLException ex) {
            Logger.getLogger(frmEditarPersona.class.getName()).log(Level.SEVERE, null, ex);
        }

        return xlista;
    }

    private void cargarTablaOdontologo(int opcion, char genero) {
        try {
            Conexion_BD conexion = new Conexion_BD();
            ResultSet rs = null;
            conexion.Conectar();
            String query = "SELECT o.CMP,o.especialidad,p.nombres,p.apellidoPaterno,p.apellidoMaterno,p.dni,u.nombre,p.domicilio,p.email,p.telefono,p.celular,p.genero,p.nacionalidad,o.facultad,p.fechanac,u.coddepto,u.codprov,u.coddist,p.idPersona FROM  odontologo o,persona p , ubigeo u WHERE o.idPERSONA = p.idPERSONA AND p.idUbigeo = u.idUbigeo AND p.genero like '" + genero + "'";
            String busqueda = txtBusqueda.getText();

            switch (opcion) {
                case 0:
                    query += " AND p.nombres like '" + busqueda + "%'";
                    break;
                case 1:
                    query += " AND p.apellidoPaterno like '" + busqueda + "%'";
                    break;
                case 2:
                    query += " AND p.apellidoMaterno like '" + busqueda + "%'";
                    break;

            }



            rs = conexion.Consultar(query);



            int fila = 0;
            while (rs.next()) {

                // PARAMETROS (dato a ingresar, fila, y columna)
                // Columna se inicia en 0
                ArrayList<Object> registro = new ArrayList<Object>();


                // Activar si falla el otro
                tblOdontologo.setValueAt(rs.getString(1), fila, 0);
                tblOdontologo.setValueAt(rs.getString(2), fila, 1);
                tblOdontologo.setValueAt(rs.getString(3), fila, 2);
                tblOdontologo.setValueAt(rs.getString(4) + " " + rs.getString(5), fila, 3);
                tblOdontologo.setValueAt(rs.getString(6), fila, 4);
                tblOdontologo.setValueAt(rs.getString(7), fila, 5);
                tblOdontologo.setValueAt(rs.getString(8), fila, 6);
                tblOdontologo.setValueAt(rs.getString(9), fila, 7);
                tblOdontologo.setValueAt(rs.getString(10), fila, 8);
                tblOdontologo.setValueAt(rs.getString(11), fila, 9);
                tblOdontologo.setValueAt(rs.getString(12), fila, 10);


                registro.add(rs.getString(1));
                registro.add(rs.getString(2));
                registro.add(rs.getString(3));
                registro.add(rs.getString(4));
                registro.add(rs.getString(5));
                registro.add(rs.getString(6));
                registro.add(rs.getString(7));
                registro.add(rs.getString(8));
                registro.add(rs.getString(9));
                registro.add(rs.getString(10));
                registro.add(rs.getString(11));
                registro.add(rs.getString(12));
                registro.add(rs.getString(13));
                registro.add(rs.getString(14));
                registro.add(rs.getString(15));
                registro.add(rs.getString(16));
                registro.add(rs.getString(17));
                registro.add(rs.getString(18));
                registro.add(rs.getString(19));
                listado.add(registro);
                                
                fila++;
                               
            }
            
          
//            DefaultTableModel modelProducto = (DefaultTableModel)this.tblOdontologo.getModel();
//			
//			modelProducto.getDataVector().clear();
//			for(int i=0; i<listado.size(); i++ ) {
//               
//				Vector fila = new Vector();
//				fila.addElement(listado.get(i).get(0));  
//				fila.addElement(producto.getNombre());
//				fila.addElement(producto.getPrecio());
//				fila.addElement(producto.getStock());
//				fila.addElement(producto.getCategoria().getNombre());
//				
//				modelProducto.addRow(fila);				
//			}
//            


            try {
                conexion.Desconectar();
            } catch (Exception ex) {
                Logger.getLogger(frmEditarPersona.class.getName()).log(Level.SEVERE, null, ex);
            }
            rs.close();
        } catch (ClassNotFoundException ex) {
            Logger.getLogger(frmEditarPersona.class.getName()).log(Level.SEVERE, null, ex);
        } catch (SQLException ex) {
            Logger.getLogger(frmEditarPersona.class.getName()).log(Level.SEVERE, null, ex);
        }  
    }

    private void cargarDepartamentos() {
        try {
            Conexion_BD conexion = new Conexion_BD();

            conexion.Conectar();

            ResultSet datos = null; // ResultSet guarda la consulta en memoria

            datos = conexion.Consultar("SELECT idUbigeo,nombre FROM ubigeo where codprov = 0 and coddist = 0");

            while (datos.next()) {
                comboDepto.addItem(datos.getString("nombre"));
            }

            conexion.Desconectar();
            datos.close();

        } catch (Exception ex) {
            Logger.getLogger(frmEditarPersona.class.getName()).log(Level.SEVERE, null, ex);
        }


    }

    private void cargarProvincias(int codigo) {
        try {
            Conexion_BD conexion = new Conexion_BD();

            conexion.Conectar();

            ResultSet datos = null;

            datos = conexion.Consultar("select idUbigeo,nombre from ubigeo where coddist = 0 and codprov <> 0 and coddepto =" + codigo);

            while (datos.next()) {
                comboProvincia.addItem(datos.getString("nombre"));
            }
            try {
                conexion.Desconectar();
            } catch (Exception ex) {
                Logger.getLogger(frmEditarPersona.class.getName()).log(Level.SEVERE, null, ex);
            }
            datos.close();
        } catch (ClassNotFoundException ex) {
            Logger.getLogger(frmEditarPersona.class.getName()).log(Level.SEVERE, null, ex);
        } catch (SQLException ex) {
            Logger.getLogger(frmEditarPersona.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    private void cargarDistritos(int depto, int provincia) {
        try {
            Conexion_BD conexion = new Conexion_BD();

            conexion.Conectar();

            ResultSet datos = null;

            datos = conexion.Consultar("SELECT idUbigeo,nombre FROM UBIGEO where coddepto = " + depto + " and codprov = " + provincia + " and coddist <> 0");

            while (datos.next()) {
                comboDistrito.addItem(datos.getString("nombre"));
            }
            try {
                conexion.Desconectar();
            } catch (Exception ex) {
                Logger.getLogger(frmEditarPersona.class.getName()).log(Level.SEVERE, null, ex);
            }
            datos.close();
        } catch (ClassNotFoundException ex) {
            Logger.getLogger(frmEditarPersona.class.getName()).log(Level.SEVERE, null, ex);
        } catch (SQLException ex) {
            Logger.getLogger(frmEditarPersona.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    public void limpiarTablaOdontologo() {
        int fila = 0;

        for (int i = 0; i < tblOdontologo.getRowCount(); i++) {

            tblOdontologo.setValueAt("", i, 0);
            tblOdontologo.setValueAt("", i, 1);
            tblOdontologo.setValueAt("", i, 2);
            tblOdontologo.setValueAt("", i, 3);
            tblOdontologo.setValueAt("", i, 4);
            tblOdontologo.setValueAt("", i, 5);
            tblOdontologo.setValueAt("", i, 6);
            tblOdontologo.setValueAt("", i, 7);
            tblOdontologo.setValueAt("", i, 8);
            tblOdontologo.setValueAt("", i, 9);
            tblOdontologo.setValueAt("", i, 10);

        }
    }

    public static void main(String args[]) {
        /*
         * Set the Nimbus look and feel
         */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /*
         * If Nimbus (introduced in Java SE 6) is not available, stay with the
         * default look and feel. For details see
         * http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(frmEditarPersona.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(frmEditarPersona.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(frmEditarPersona.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(frmEditarPersona.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /*
         * Create and display the form
         */
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new frmEditarPersona().setVisible(true);

            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnActualizar;
    private javax.swing.JButton btnBuscar;
    private javax.swing.JButton btnEliminar;
    private javax.swing.JButton btnModificar;
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.ButtonGroup buttonGroup2;
    private javax.swing.JComboBox comboBuscar;
    private javax.swing.JComboBox comboDepto;
    private javax.swing.JComboBox comboDistrito;
    private datechooser.beans.DateChooserCombo comboFecha;
    private javax.swing.JComboBox comboProvincia;
    private javax.swing.JButton jButton1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel24;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTabbedPane jTabbedPane2;
    private javax.swing.JTextField jTextField1;
    private javax.swing.JPanel panelOdontologo;
    private javax.swing.JRadioButton rbtFemenino;
    private javax.swing.JRadioButton rbtFemenino1;
    private javax.swing.JRadioButton rbtMasculino;
    private javax.swing.JRadioButton rbtMasculino1;
    private javax.swing.JRadioButton rbtTodos;
    private javax.swing.JTable tblOdontologo;
    private javax.swing.JTabbedPane tbpaneMantenerOdontologos;
    private javax.swing.JTextField txtApellidoMaterno;
    private javax.swing.JTextField txtApellidoPaterno;
    private javax.swing.JTextField txtBusqueda;
    private javax.swing.JTextField txtCMP;
    private javax.swing.JTextField txtCelular;
    private javax.swing.JTextField txtDireccion;
    private javax.swing.JTextField txtDni;
    private javax.swing.JTextField txtEdad;
    private javax.swing.JTextField txtEmail;
    private javax.swing.JTextField txtEspecialidad;
    private javax.swing.JTextField txtFacultad;
    private javax.swing.JTextField txtNacionalidad;
    private javax.swing.JTextField txtNombres;
    private javax.swing.JTextField txtTel;
    // End of variables declaration//GEN-END:variables
}
